package com.google.android.play.core.assetpacks;

import c.b.a.c.a.c.z;
import java.io.File;
import java.util.concurrent.Executor;

final class c2 {

    /* renamed from: a  reason: collision with root package name */
    private final b0 f2474a;

    /* renamed from: b  reason: collision with root package name */
    private final z<i3> f2475b;

    /* renamed from: c  reason: collision with root package name */
    private final m1 f2476c;

    /* renamed from: d  reason: collision with root package name */
    private final z<Executor> f2477d;
    private final y0 e;

    c2(b0 b0Var, z<i3> zVar, m1 m1Var, z<Executor> zVar2, y0 y0Var) {
        this.f2474a = b0Var;
        this.f2475b = zVar;
        this.f2476c = m1Var;
        this.f2477d = zVar2;
        this.e = y0Var;
    }

    public final void a(a2 a2Var) {
        File k = this.f2474a.k(a2Var.f2586b, a2Var.f2461c, a2Var.f2462d);
        File t = this.f2474a.t(a2Var.f2586b, a2Var.f2461c, a2Var.f2462d);
        if (!k.exists() || !t.exists()) {
            throw new v0(String.format("Cannot find pack files to move for pack %s.", new Object[]{a2Var.f2586b}), a2Var.f2585a);
        }
        File c2 = this.f2474a.c(a2Var.f2586b, a2Var.f2461c, a2Var.f2462d);
        c2.mkdirs();
        if (k.renameTo(c2)) {
            File i = this.f2474a.i(a2Var.f2586b, a2Var.f2461c, a2Var.f2462d);
            i.mkdirs();
            if (t.renameTo(i)) {
                b0 b0Var = this.f2474a;
                b0Var.getClass();
                this.f2477d.a().execute(b2.a(b0Var));
                this.f2476c.d(a2Var.f2586b, a2Var.f2461c, a2Var.f2462d);
                this.e.b(a2Var.f2586b);
                this.f2475b.a().b(a2Var.f2585a, a2Var.f2586b);
                return;
            }
            throw new v0("Cannot move metadata files to final location.", a2Var.f2585a);
        }
        throw new v0("Cannot move merged pack files to final location.", a2Var.f2585a);
    }
}
